package com.umpay.controller.common;

import com.umpay.controller.base.AbstractController;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @ClassName: CommonController  
 * @Description: 公共的控制器
 * @author zhangtao  
 * @date May 26, 2018
 */
@RestController
public class CommonController  extends AbstractController {

	private static final Logger log = LogManager.getLogger(CommonController.class);
	
	@GetMapping("/common/error")
	public ModelAndView error(HttpServletRequest request,HttpServletResponse response) {
		String errorCode = request.getParameter("errorCode");
		String errorMsg  = request.getParameter("errorMsg");
		ModelAndView view = new ModelAndView("common/error");
		view.addObject("errorCode", errorCode);
		view.addObject("errorMsg", errorMsg);
		log.info(String.format("【异常信息】返回码[%s],返回描述[%s]", errorCode,errorMsg));
		return view;
	}
}
